package tuhoc1;

import java.util.Scanner;

public class Tamgiac {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String strTemp="";
		double dside01;
		double dside02;
		double dside03;
		double p;
		float S;
		do {
			
		
		do {
			System.out.println("moi nhap vao canh cua tam giac a=");
			strTemp=sc.nextLine();
		} while (strTemp.isEmpty()
				||Integer.parseInt(strTemp)<=0);
		dside01=Double.parseDouble(strTemp);
		
		do {
			System.out.println("moi nhap vao canh cua tam giac b=");
			strTemp=sc.nextLine();
		} while (strTemp.isEmpty()
				||Integer.parseInt(strTemp)<=0);
		 dside02=Double.parseDouble(strTemp);
		
		do {
			System.out.println("moi nhap vao canh cua tam giac c=");
			strTemp=sc.nextLine();
		} while (strTemp.isEmpty()
				||Integer.parseInt(strTemp)<=0);
		 dside03=Double.parseDouble(strTemp);
		
		
		}while((dside01+dside02<=dside03)
				||(dside02+dside03<=dside01)
				||(dside01+dside03<=dside02));
		System.out.println("chu vi cua tam giac="+(dside01+dside02+dside03));
		
		p=(dside01+dside02+dside03)/2;
		S=	(float)Math.sqrt(p*(p-dside01)*(p-dside02)*(p-dside03));
		System.out.println("dien tich cua tam giac="+S);
	}

}
